#include <iostream>
#include <thread>
#include <unistd.h>

//c++11的多线程，在Linux下是对pthread的封装

void hello()
{
    while (true)
    {
        sleep(1);
        std::cout << "hello, pid: " << getpid() << std::endl;
    }
}

int main()
{
    std::thread t(hello);
    //t.join();
    while (true)
    {
        std::cout << "我是主线程...，pid：" << getpid() << std::endl;
        sleep(1);
    }

    return 0;
}